using System.Collections;
using DailyReport.Core.Data.Dao;
using DailyReport.Core.Data.Model;
using DailyReport.Core.Util;
using NHibernate;

namespace DailyReport.NHibernateDao.Data.Dao
{
    public class DailyDao : NHibernateBaseDao<Daily, int>, IDailyDao
    {
        public Daily GetCurrentDailyByUser(int userid)
        {
            //ISession session = ConnectionManager.Instance.Session;

            IQuery query = session.CreateQuery("from Daily d where d.User.ID = :userId and d.Current = true");
            query.SetInt32("userId", userid);
            return (Daily) query.UniqueResult();
        }
    }
}